package xyz.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.util.Date;


@Entity(tableName = "note")
public class Note {

    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id")
    public int id;

    @ColumnInfo(name = "bid")
    public int bookId;

    @ColumnInfo(name = "title")
    public String title;

    @ColumnInfo(name = "content")
    public String content;

    @ColumnInfo(name = "created")
    public Date created;

    @ColumnInfo(name = "updated")
    public Date updated;


    public void setTitle(String title) {
        this.title = title;
    }

    public void setText(String text) {
        this.content = text;
    }

    public int getId() {
        return id;
    }

    public Date getCreated() {
        return created != null ? created : new Date();
    }

    public Date getUpdated() {
        return updated;
    }

    public int getBookId() {
        return bookId;
    }

    public String getContent() {
        return content;
    }

    public String getTitle() {
        return title;
    }
}
